<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #app div {
        border: solid;
        padding: 10px;
      }
    </style>
  </head>

  <body>
    <div id="app"></div>
    <script type="module">
      import { createApp, ref } from "./vue.esm-browser.js";

      // 组件化
      import MyButton from "./components/MyButton.js";

      const html = String.raw;

      // <root>
      const app = createApp({
        setup() {
          const count = ref(0);
          return {
            count,
          };
        },
        template: html`<div>
          <h1>Root</h1>
          {{count}}<button @click="count++">+</button>
          <MyButton></MyButton>
          <MyButton></MyButton>
          <MyButton></MyButton>
        </div> `,
      });

      app.component("MyButton", MyButton);

      app.mount("#app"); //挂载
    </script>
  </body>
</html>
